package eight.test_8_10;

import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class TestMain1 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        scanner.nextLine();
        String key = scanner.nextLine();
        int size = key.length();
        int min = 0;
        int max = 0;
        Set<String> set = new HashSet<>();
        int[] dq = new int[1001];
        for (int i = 0; i < n; i++) {
            String str = scanner.nextLine();
            set.add(str);
        }
        for (String str : set) {
            int len = str.length();
            if(len < size) {
                min++;
            }
            if(len <= size) {
                max++;
            }
        }
        System.out.println((min + 1) + " " + (max - 1));
    }
}
